package com.sample.transitiondemo;

import android.app.Application;

import com.facebook.common.memory.MemoryTrimType;
import com.facebook.common.memory.MemoryTrimmable;
import com.facebook.common.memory.MemoryTrimmableRegistry;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipelineConfig;

/**
 * Created by guo
 *
 * @ 2016/11/4
 */

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

        MemoryTrimmableRegistry registry = new MemoryTrimmableRegistry() {
            @Override
            public void registerMemoryTrimmable(MemoryTrimmable trimmable) {
                trimmable.trim(MemoryTrimType.OnAppBackgrounded);
            }

            @Override
            public void unregisterMemoryTrimmable(MemoryTrimmable trimmable) {

            }
        };
        ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this)
                .setMemoryTrimmableRegistry(registry)
                .build();
        Fresco.initialize(this, imagePipelineConfig);
    }
}
